﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Hr.Entity;
namespace Chenxin.Lib.Hr.BLL
{
    /// <summary>
    /// 业务逻辑类Struct_CityBaseInfo 的摘要说明。
    /// </summary>
    public class Struct_CityBaseInfo
    {
        public Struct_CityBaseInfo()
        { }
        #region  成员方法
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Hr.DAL.Struct_CityBaseInfo.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Hr.Entity.Struct_CityBaseInfo> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Hr.DAL.Struct_CityBaseInfo.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Hr.Entity.Struct_CityBaseInfo> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Hr.Entity.Struct_CityBaseInfo> modelList = new List<Chenxin.Lib.Hr.Entity.Struct_CityBaseInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Hr.Entity.Struct_CityBaseInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Hr.Entity.Struct_CityBaseInfo();
                    if (dt.Rows[n]["CityId"].ToString() != "")
                    {
                        model.CityId = new Guid(dt.Rows[n]["CityId"].ToString());
                    }
                    model.CityCode = dt.Rows[n]["CityCode"].ToString();
                    model.CityName = dt.Rows[n]["CityName"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }


        #endregion  成员方法
    }
}

